//
//  MainTabBarController.m
//  TimeMovie
//
//  Created by qianfeng on 15/11/30.
//  Copyright (c) 2015年 qianfeng. All rights reserved.
//

#import "MainTabBarController.h"
#import "HomePageViewController.h"
#import "ClassifyViewController.h"
#import "NearbyViewController.h"
@interface MainTabBarController ()

@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createTabBar];
}
#pragma mark - 自定制创建tabbar
-(void)createTabBar
{
    NSMutableArray* viewControllerArray=[[NSMutableArray alloc]init];
    NSArray* classNameArray=@[@"HomePageViewController",@"ClassifyViewController",@"NearbyViewController"];
    NSArray* titleArray=@[@"首页",@"分类",@"附近"];
    NSArray* imageArray=@[@"tabbar_homepage_normal",@"tabbar_classify_normal",@"tabbar_vicinity_normal"];
    NSArray* seleteImageArray=@[@"tabbar_homepage_selected",@"tabbar_classify_selected",@"tabbar_vicinity_selected"];
    int i=0;
    for (NSString* className in classNameArray) {
        Class class=NSClassFromString(className);
        BasicViewController* vc=[[class alloc]init];
        UINavigationController* nvc=[[UINavigationController alloc]initWithRootViewController:vc];
        nvc.tabBarItem.title=titleArray[i];
        nvc.tabBarItem.image=imageNameRenderStr(imageArray[i]);
        nvc.tabBarItem.selectedImage=imageNameRenderStr(seleteImageArray[i]);
        [viewControllerArray addObject:nvc];
        i++;
    }
    self.viewControllers=viewControllerArray;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
